<%--
  Created by IntelliJ IDEA.
  User: SYHT
  Date: 2017/4/10
  Time: 14:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%--<title>four</title>--%>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script>
        function choose(sel) {
            if (sel.value == '1') {
                document.getElementById('face2').style.display = 'block';
            }
            else if (sel.value == '2') {
                document.getElementById('face2').style.display = 'none';
            }
        }
    </script>
    <jsp:include page="documentForeEnd.jsp"/>
    <link href="${pageContext.request.contextPath}/dist/foreEnd/css/bootstrap.css" rel="stylesheet"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/foreEnd/css/jeDate.css" type="text/css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/dist/foreEnd/js/jeDate.js"></script>
    <script type="text/javascript">
        var isComment = false;

        $(function () {
            //添加div
            $(".four_b").click(function () {
                var div = '<div class="div2">' +
                    '<form action="${pageContext.request.contextPath}/Comment/addComment.do" method="post" class="div3">' +
                    '<textarea class="bp" rows="4" cols="70" name="commentContext"></textarea><br>' +
                    '<input type="hidden" name="empId" value="${userForeEnd.empId}">' +
                    '<input type="hidden" name="empName" value="${userForeEnd.empName}">' +
                    '<input type="hidden" name="personId" value="${param.personId}">' +
                    '<button type="submit" class="ee">保存</button> </form>' +
                    '<div class="commondivremove"><button class="four_g">删除</button></div></div>';
                $("#div1").append(div);
            });
            //移除div
            $("#div1").on('click', 'button[class="four_g"]', function () {
                $(this).parents('.div2').remove();
            });
            var add = $(".four_b")[0];
            if (${person.personRecord=='3'||person.personRecord=='4'}) {
                add.style.display = "none";
            }

        });

        var tis = new tis(300);
        function pingji(level) {
            $.ajax({
                url: "${pageContext.request.contextPath}/Person/updateAudit.do",
                data: {"level": level, "personId": '${person.personId}'},
                type: "post",
                dataType: "json",
                success: function (data) {
                    if (data.msg == "ok") {
                        tis.alert("等级修改为" + level);
                    } else if (data.msg == "error") {
                        tis.alert("等级修改失败");
                    }
                }
            })
        }
        function validComment() {
            if (isComment) {
                return true;
            } else {
                tis.alert("请先添加评价");
                return false;
            }
        }

        /*function hidFromSub() {
            document.getElementById("hidFrom").submit();
        }*/


    </script>

</head>
<body>
<header>
    <jsp:include page="headerForeEnd2.jsp"/>
</header>
<div class="myHyalineBox"></div>
<a href="${pageContext.request.contextPath}/Person/selPersonAll.do"><span class="dd fa fa-arrow-left fa-2x"></span></a>
<%--<form id="hidFrom" action="${pageContext.request.contextPath}/Person/selPersonAll.do" method="post">
    <input id="thePage" type="hidden" name="page" value="${page}">
    <input type="text" name="personName" value="${searchPerson.personName}"/>

    <input type="text" name="personTel" value="${searchPerson.personTel}"/>

    <input name="begin" value="<fmt:formatDate value="${begin}" type="both"
                                            pattern="yyyy-MM-dd"/>"/>

    <input name="end" value="<fmt:formatDate value="${end}" type="both"
                                            pattern="yyyy-MM-dd"/>"/>
    <input type="text" name="empName" value="${searchPerson.empName}"/>
    <input type="text" name="personRecord" value="${searchPerson.personRecord}">
    <input type="text" name="personAudit" value="${searchPerson.personAudit}">
    <input type="text" name="personReception" value="${searchPerson.personReception}">
</form>--%>
<div class="container">
    <div style="clear: both"></div>

    <div class="four_l">
        <form action="${pageContext.request.contextPath}/Person/updateComment.do" method="get" class="dark-matter2"
              style="margin-bottom: 60px" onsubmit="return validComment()">

            <h3 class="four">个人信息</h3>
            <input type="hidden" name="personId" value="${person.personId}">
            <label for="name">
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;姓名 :</span>
                <input id="name" type="text" name="personName" value="${person.personName}" autocomplete="off"
                       readonly="readonly"/>
            </label>

            <label for="position">
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;应聘职位 : </span>
                <input id="position" type="text" name="personJob" style="width: 300px" value="${person.personJob}"
                       autocomplete="off" readonly="readonly"/>
            </label>

            <label>
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;性别 : </span>
                <input name="personSex" type="radio" id="sex"
                       <c:if test="${person.personSex=='男'}">checked="checked"</c:if>>男
                <input name="personSex" type="radio" id="sex2"
                       <c:if test="${person.personSex=='女'}">checked="checked"</c:if>>女
            </label>

            <label for="age">
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;年龄: </span>
                <input id="age" type="text" name="personAge" value="${person.personAge}" autocomplete="off"
                       readonly="readonly"/>
            </label>

            <label for="birthday">
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;生日 : </span>
                <input id="birthday" type="text" name="personBirth" value="${person.personBirth}" autocomplete="off"
                       readonly="readonly"/>
            </label>

            <label for="number">
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;电话 : </span>
                <input id="number" type="text" name="personTel" value="${person.personTel}" autocomplete="off"
                       readonly="readonly"/>
            </label>

            <label for="education">
                <span><span class="fa fa-cog fa-spin"></span> 学历 : </span>
                <input id="education" type="text" name="personEducation" value="${person.personEducation}"
                       autocomplete="off" readonly="readonly"/>
            </label>

            <label for="experience">
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;工作经验 : </span>
                <input id="experience" type="text" name="personExp" value="${person.personExp}" autocomplete="off"
                       readonly="readonly"/>
            </label>

            <label>
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;面试时间 : </span>
                <input name="interviewTime" readonly="readonly"
                       style="font-size: 17px;background-color: #DFDFDF;color: #0a0a0a" class="datainp" id="dateinfo"
                       value="<fmt:formatDate value="${person.interviewTime}" type="both"
                                            pattern="yyyy-MM-dd hh:mm:ss"/>">
            </label>

            <%--面试时间：<input name="interviewTime" readonly="readonly" class="datainp" id="dateinfo" value="<fmt:formatDate value="${person.interviewTime}" type="both"--%>
            <%--pattern="yyyy-MM-dd"/>">--%>

            <label>
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;等级 : </span>
                <input name="personAudit" type="radio" id="personAudit1" onchange="pingji('A')"
                       <c:if test="${person.personAudit=='A'}">checked="checked"</c:if>>A
                <input name="personAudit" type="radio" id="personAudit2" onchange="pingji('B')"
                       <c:if test="${person.personAudit=='B'}">checked="checked"</c:if>>B
                <input name="personAudit" type="radio" id="personAudit3" onchange="pingji('C')"
                       <c:if test="${person.personAudit=='C'}">checked="checked"</c:if>>C
            </label>

            <label>
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;颜值 </span>
                <select id="face" name="personReception" onchange='choose(this);'
                        style="width: 170px;background-color: #DFDFDF;height: 25px;font-size: 16px;padding-left: 10px">
                    <option value="" selected="selected">请选择</option>
                    <option value="1" <c:if test="${person.personReception=='1'}">selected="selected"</c:if>>合格</option>
                    <option value="2" <c:if test="${person.personReception=='2'}">selected="selected"</c:if>>不合格</option>
                </select>
            </label>


            <label id="face2" style="display: none">
                <span><span class="fa fa-cog fa-spin"></span>&nbsp;&nbsp;阶段 : </span>
                <input name="personRecord" type="radio" id="personRecord1" value="1"
                       <c:if test="${person.personRecord=='1'}">checked="checked"</c:if>>没来
                <input name="personRecord" type="radio" id="personRecord2" value="2"
                       <c:if test="${person.personRecord=='2'}">checked="checked"</c:if>>待命
                <input name="personRecord" type="radio" id="personRecord3" value="3"
                       <c:if test="${person.personRecord=='3'}">checked="checked"</c:if>>pass
                <input name="personRecord" type="radio" id="personRecord4" value="4"
                       <c:if test="${person.personRecord=='4'}">checked="checked"</c:if>>通过
            </label>


            <span>&nbsp;</span>
            <c:if test="${userForeEnd.empRole!=4}">
                <button type="submit"
                        class="button5">保存
                </button>
            </c:if>
            <a target="_blank" href="${pageContext.request.contextPath}/resumeUpload/${person.personResume}"
               class="button">查看简历</a>
        </form>
    </div>

    <div class="four_r">
        <h3 class="four_h3">阶段评价</h3>
        <button class="four_b" type="submit">添加评价</button>
        <div id="div1" style="width: 550px;height: 600px;overflow: auto">
            <%--评价遍历--%>
            <c:forEach items="${person.commentList}" var="ct">
                <div class="div2">
                    <form action="" method="post" class="div3">
                        <textarea class="bp" rows="4" cols="70" readonly="readonly">${ct.commentContext}</textarea><br>
                        <span class="qq1">用户名:</span>
                        <input type="text" name="loginName" id="name1" class="qq" value="${ct.empName}"
                               readonly="readonly">
                        <span class="bb">时间:</span>
                        <input class="bb" id="searchp" name="search" style="color:#FFFFFF;width: 300px"
                               value="<fmt:formatDate value="${ct.createTime}" type="both" pattern="yyyy年MM月dd日 HH:mm:ss"/>"
                               readonly="readonly"/>
                    </form>
                </div>
            </c:forEach>
        </div>
    </div>


    <div id="datePlugin"></div>
    <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">

    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $('#nav li').hover(function () {
            $('ul', this).slideDown(200);
            $(this).children('a:first').addClass("hov");
        }, function () {
            $('ul', this).slideUp(100);
            $(this).children('a:first').removeClass("hov");
        });
        choose(document.getElementById("face"));
        $.ajax({
            url: "${pageContext.request.contextPath}/Comment/selCommentExist.do",
            data: {"personId": '${person.personId}'},
            type: "post",
            dataType: "json",
            async: false,
            success: function (data) {
                if (data.msg == "yes") {
                    isComment = true;
                } else if (data.msg == "no") {
                    isComment = false;
                }
            }
        })
    });
</script>
<script type="text/javascript">
    jeDate({
        dateCell: "#dateinfo",
        isinitVal: false,
        isTime: true,
        minDate: "2014-09-19 00:00:00"
    })
</script>
</body>
</html>
